 <?php
echo CHtml::scriptFile('/js/jquery.js');
echo CHtml::scriptFile('http://vkontakte.ru/js/api/xd_connection.js?2');
echo CHtml::cssFile('/css/main.css');
echo CHtml::script(
"
$(document).ready(function() {
	$('body').append(\"<iframe id='cookiesHackFrame' name='cookiesHackFrame' src='http://imhomusic.imhonet.biz/cookies' style='display:none;'></iframe>\");
    $('body').append(\"<form id='cookiesHackForm' action='http://imhomusic.imhonet.biz/cookies' method='post' target='cookiesHackFrame' >\");
    $('#cookiesHackForm').submit();

	VK.init(function() {
		var fields = 'uid,first_name,last_name,nickname,screen_name,sex,'
					+'bdate,city,country, timezone, photo, photo_medium,'
					+'photo_big, has_mobile, rate, contacts, education, online';
		VK.api('getProfiles', {uids: ".$viewer_id.", fields: fields}, function(data) {
		
			if (data.response) {
				$.ajax({
					url: '/registration',
					type: 'POST',
					data: {profiles:data.response},
					dataType: 'json'
				})
				.success(function(data) {
					
					if (data.redirect)
						window.location = data.redirect;
					else if (response.html) {
						obj.replaceWith(response.html);
					}
					else if (response.reload)
						window.location.reload();
				})
				.error(function(data) {
				});
			} 
		});
	});
});
");
 ?>
 